package com.zx._02_thread.基本操作;

import com.zx.common.util.ThreadUtil;
import java.util.Timer;
import java.util.TimerTask;

public class TimerTest {

    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("timer task1");
            }
        }, 0L, 500L);

        // 取消timer
        ThreadUtil.sleep(5);
        timer.cancel();
    }
}
